package chapter7;

/**
 * Created by lenovo on 2016/3/23.
 */
public class MultiChat {
    public static void main(String[] args) {
        Client c1=new Client("127.0.0.1","Caterpillar");
        Client c2=new Client("192.168.0.2","Justin");

        ClientQueue queue=new ClientQueue();
        queue.addClientListener(new ClientListener() {
            @Override
            public void clientAdded(ClientEvent event) {
                System.out.printf("%s 从 %s 联机%n",event.getName(),event.getIp());
            }

            @Override
            public void clientRemoved(ClientEvent event) {
                System.out.printf("%s 从 %s 联机%n",event.getName(),event.getIp());

            }
        });
    }
}
